package com.cug.campus_sh_market_server.util;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.nycreativity.elecreativity.entity.vo.PageDataVO;

/**
 * 分页数据转换工具
 */
public class PageUtil {

    public static <T> PageDataVO<T> convert(IPage<T> resultList) {
        PageDataVO<T> tPageDataVO = new PageDataVO<>();
        tPageDataVO.setRecords(resultList.getRecords());
        tPageDataVO.setTotal((int) resultList.getTotal());
        tPageDataVO.setCurrentPage((int) resultList.getCurrent());
        tPageDataVO.setPageSize((int) resultList.getSize());
        tPageDataVO.setPages((int) resultList.getPages());
        return tPageDataVO;
    }
}
